<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>删除页面上所有的p元素</title>
    <style>
        .separator {
            border-top: 2px solid black;
            margin-top: 20px;
        }
    </style>
</head>
<body>
<p>什么是JavaScript</p>
<p>JavaScript是一门功能强大的编程语言</p>
<h3 style="font-size: 24px;">一起来学习JavaScript程序设计</h3>
<div class="separator"></div>
<p>JavaScript的发展历史</p>
<button id="deleteButton">删除所有p元素</button>


<script>
    document.getElementById("deleteButton").addEventListener("click", deleteP);
    function deleteP() {
        var pElements = document.getElementsByTagName("p");
        for (var i = 0; i < pElements.length; i++) {
            pElements[i].parentNode.removeChild(pElements[i]);
        }
    }
</script>
</body>
</html>